/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						 play_combat_flight.h

	$Header: /heroes4/play_combat_flight.h $

	$NoKeywords: $

 ************************************************************************/

#if !defined( PLAY_COMBAT_FLIGHT_H_INCLUDED )
#define PLAY_COMBAT_FLIGHT_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <list>
#include "combat_creature_handler.h"
#include "counted_animation.h"
#include "counted_idle_processor.h"
#include "map_point.h"
#include "playing_sound_ptr.h"

class t_abstract_combat_object;
class t_battlefield;
class t_combat_creature;
// -----------------------------------------------------------------------
// fly to a location
// -----------------------------------------------------------------------
class t_play_combat_flight : public t_counted_idle_processor, public t_counted_animation
{
public:
	t_play_combat_flight( t_combat_creature& creature, 
						  t_map_point_3d const& destination,
					      t_combat_creature_handler    end_handler );
	virtual ~t_play_combat_flight();
	virtual void on_idle();
protected:
	t_map_point_3d			  advance();
	void					  compute_distances( int frame );
	void					  compute_next_waypoint();
	t_abstract_combat_object* get_tallest_object( t_map_point_2d const& point ) const;

	typedef t_counted_ptr<t_abstract_combat_object> t_object_ptr;
	typedef std::list<t_object_ptr>                 t_object_list;

	t_combat_creature&			m_creature;
	t_combat_creature_handler	m_end_handler;
	t_map_point_3d				m_delta;
	t_map_point_3d              m_delta_sign;
	t_map_point_3d				m_destination;
	int                         m_frames;
	t_object_ptr                m_obstacle;
	t_object_list               m_passed_obstacles;
	t_playing_sound_ptr         m_sound;
	t_object_ptr                m_spell_effect;
	t_map_point_3d				m_sum;
	int							m_threshold;
	t_map_point_3d				m_waypoint;
};

typedef t_counted_ptr< t_play_combat_flight > t_play_combat_flight_ptr;

#endif // PLAY_COMBAT_FLIGHT_H_INCLUDED